/*common*/
$(function(){
    //头部顶部下拉菜单
    (function(){
        var enterTimer,leaveTimer,speed=50,delay=50;
        $('.head .topMenu').on({
            mouseenter: function () {
                var $this=$(this);
                clearTimeout(enterTimer);
                enterTimer=setTimeout(function () {
                    $this.stop().addClass('hl').find('dd').slideDown(speed);
                },delay);
            },
            mouseleave: function () {
                var $this=$(this);
                leaveTimer=setTimeout(function () {
                    $this.stop().removeClass('hl').find('dd').slideUp(speed);
                },delay);
            }
        },'.more');
    })();


    //内页类目导航切换
    (function () {
        var $all=$('#all_category_inner'),$list=$('#menuList4inner');
        var delay=500,allTimer,listTimer;
        var show= function () {
            $list.show();
        };
        var hide= function () {
            $list.hide();
        };

        //二级类目菜单显示隐藏
        $list.on({
            mouseenter: function () {
                $(this).addClass('open');
            },
            mouseleave: function () {
                $(this).removeClass('open');
            }
        },'dl');

        //内页整个类目菜单显示隐藏
        $all.on({
            mouseenter: function () {
                clearTimeout(allTimer);
                clearTimeout(listTimer);
                show();
            },
            mouseleave: function () {
                allTimer=setTimeout(function(){
                    hide();
                },delay);
            }
        });
        $list.on({
            mouseenter: function () {
                clearTimeout(allTimer);
                show();
            },
            mouseleave: function () {
                listTimer=setTimeout(function(){
                    hide();
                },delay);
            }
        });
    })();
});